﻿using System;
using System.Threading;

namespace Fluffy.Library.Utils
{
	public static class ThreadUtils
	{
		public static void StartThread(ThreadStart action)
		{
			Thread thread = new Thread(action);
			thread.IsBackground = true;
			thread.Start();
		}

		public static void SleepWhile(Func<bool> expression, int duration = 500)
		{
			while (expression())
			{
				Thread.Sleep(duration);
			}
		}
	}
}
